from api.charts.ChartGenerate import ChartGenerate
from api.mod.eventGenerato import EventGenerator
from api.mod.modLoader import ModLoader
from framework.adapter.auth import StringAuth2Instance
from framework.modfuncexecute import ModFuncExecute
from framework.syntacticSugar.EventEntiys import EventEntiys
from runable.main import show


def json():
    return {
        "青兰": {
            'city': (["城市1", (6, 14)], ["城市2", (9, 4)], ["城市3", (4, 7)]),
            'army': (("陈时", "洛斯"), (5, 20)),
            'block': ((1, 1), (1, 2), (1, 3))
        },

    }

def modLoader_test():
    mod = ModLoader()
    return mod

def modGener_test():
    eventGenerator = EventGenerator("关押角色", EventEntiys(self="陈时", involver="卷零", anther=["洛斯", "雪女"], power="青兰",
                                                        argument={"value": 30}))
    eventGenerator.render_json()

def ModFuncExecute_test():
    mf = ModFuncExecute(eventname="拷问", function_path="%/function.jailDo")
    ret = mf.funtionRun("嗯嗯嗯", item="谁?")

def ChartListGenerate_test():
    chart = ChartGenerate.getCharacter_name("陈时")
    chart.fields.attack_value = 10
    chart.save()

def StringAuth_test():
    mod = ModLoader()
    chart = ChartGenerate.getCharacter_name("陈时")
    print(chart.fields.authority)

    adopt = StringAuth2Instance.doit(chart)
    print(chart.fields.authority_instance)

def unittest_1():
    a = EventGenerator("囚禁", EventEntiys())
    print(a.render_json())

StringAuth_test()
